home *** CD-ROM | disk | FTP | other *** search
- Sorry I can't quote what you said, but I hope you can remember what
- you were asking by the way I answer.
- You need to be familiar with AMOS variables and understand how numbers
- are stored for your first two problems (BTW, I don't have an answer to your
- thrid). The reason you can't get a negative result with peek is that peek
- must return a number between 0 and 255 (inclusinve) and AMOS doesn't deal with
- signed bytes (as C might). The result is converted (I am assuming) to AMOS'
- default data type... I think a long integer. So to automatically use negative
- numbers (without having to do the conversion yourself), you'll probably have
- to use loke and leek. If you must have a signed byte, this is how 2's
- complement works (2's complement is how computers handle negative numbers
- and addition). The range of a signed number is the same as that of an unsigned
- number, but everything beginning from (range+1)/2 becomes n-Range. For instance
- to do a signed byte, simply accept the result of peek, then check to see if it
- is greater than or equal to 128. If so, subtract 256 from it. (Oops, up there
- it should read that it becomes n-Range-1, 255-0=255, 128-255-1=-128)
- I won't explain precicely how the bits are flipped for subtraction and
- addition in 2's complement since I doubt you seed that.
- With that in mind, now consider this. Hunt searches for a string in
- memory. All you have to do to search for more than a byte is convert a number
- into it's byte components and put them into a string. Perhaps the easiest
- way to do it is to Loke or Doke the value into a reserved location and then
- read the bytes. OR, probably better (I just didn't think of it first), read
- each byte directly from the variable location using Varptr. If you want, for
- instance to search a range of memory for the value 31415926, do the following:
- VALUE=31415926
- for t=0 to 3
- s$=s$+peek(varptr(VALUE)+t)
- next t
-
- After you've done thism you can then hunt for s$ in you desired range of memory.
-
-